﻿<Window x:Class="RL.wVehicleType"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Модель транспортного средства" Height="286" Width="519" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:my="clr-namespace:RL" Loaded="Window_Loaded" Closing="Window_Closing">
    <Window.Resources>
        <CollectionViewSource x:Key="vehicle_typeViewSource" d:DesignSource="{d:DesignInstance my:vehicle_type, CreateList=True}" />
        <my:VehicleTypeConverter x:Key="VehicleTypeConverter"/>
    </Window.Resources>
    <Grid DataContext="{StaticResource vehicle_typeViewSource}">
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition />
            <RowDefinition Height="35"/>
        </Grid.RowDefinitions>
        <DataGrid AutoGenerateColumns="False" EnableRowVirtualization="True" ItemsSource="{Binding}" Name="vehicle_typeDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" Grid.Row="1">
            <DataGrid.Columns>
                <DataGridTextColumn x:Name="idColumn" Binding="{Binding Path=id}" Header="Код" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="nameColumn" Binding="{Binding Path=name}" Header="Наименование" Width="200" />
                <DataGridTemplateColumn x:Name="main_fuel_type">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn x:Name="id_main_fuel_typeColumn" Binding="{Binding Path=fuel_type.name}" Header="Топливо" Width="SizeToHeader" >
                    
                </DataGridTextColumn>
                <DataGridTextColumn x:Name="type_vehicleColumn" Binding="{Binding Path=type_vehicle, Converter={StaticResource VehicleTypeConverter}}" Header="type vehicle" Width="SizeToHeader"  />
                <DataGridTextColumn x:Name="heaterColumn" Binding="{Binding Path=heater}" Header="heater" Width="SizeToHeader" />
                <DataGridCheckBoxColumn x:Name="delColumn" Binding="{Binding Path=del}" Header="del" Width="SizeToHeader" />
            </DataGrid.Columns>
        </DataGrid>
        <StackPanel Name="stackPanel1" Orientation="Horizontal">
            <Button Content="Сохранить" Height="23" Name="buttonSave" Width="75" Click="buttonSave_Click"/>
            <Button Content="Добавить" Height="23" Name="buttonNew" Width="75" Click="buttonNew_Click"/>
            <Button Content="Редактировать" Height="23" Name="buttonEdit" Width="112" Click="buttonEdit_Click"/>
        </StackPanel>
        <StackPanel Grid.Row="2" Name="stackPanel2" Orientation="Horizontal">
            <Button Content="OK" Height="23" Name="buttonOK" Width="75" Click="buttonOK_Click"/>
        </StackPanel>
    </Grid>
</Window>
